package com.dzx.design.structural.facade;

/**
 * @author dzx
 * @ClassName:
 * @Description: 将兑换礼物的方法封装好，提供对外的一个外观门面
 * @date 2019年08月01日 14:08:22
 */
public class GiftExchangeService {
    private QualifyService qualifyService = new QualifyService();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShippingService shippingService = new ShippingService();



    public void giftExchange(PointsGift pointsGift) {
        if (qualifyService.isAvailable(pointsGift)) {
            //资格校验通过
            if (pointsPaymentService.pay(pointsGift)) {
                //积分支付成功
                String orderNo = shippingService.shipGift(pointsGift);
                System.out.println("物流系统下单成功，订单号是:" + orderNo);
            }
        }
    }
}
